package com.zb.media.controller;

import com.zb.media.service.WeServiceService;
import com.zb.model.common.Result;
import com.zb.model.pojo.wemedia.WmUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/media")
public class WeServiceController {
    @Autowired
    private WeServiceService weServiceService;
//    保存自媒体用户信息
    @PostMapping("/save")
    public Result save(@RequestBody WmUser wmUser) {
        Integer id = weServiceService.save(wmUser);
        return Result.SUCCESS(id);
    }
//    根据名称查询自媒体用户信息
    @GetMapping("/findByName/{name}")
    public Result<WmUser> findByName(@PathVariable("name") String name) {
        WmUser user = weServiceService.findUserByName(name);
        return Result.SUCCESS(user);
    }
}
